package com.cskaoyan.config3;

import com.alibaba.druid.pool.DruidDataSource;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author stone
 * @date 2022/06/02 14:35
 */
//@Data
//@Configuration
//@ConfigurationProperties(prefix = "cskaoyan.datasource")
public class DruidConfiguration3 {

    String driverClassName;  // "com.mysql.jdbc.Driver";
    String url;  // "jdbc:mysql://localhost:3306/cskaoyan_db?useUnicode=true&characterEncoding=utf-8";

    String username;  // "root";
    String password;  // "123456";

    @Bean
    public DruidDataSource dataSource3() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(driverClassName);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
        return dataSource;
    }
}
